<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/axios.min.js"></script>
    <script type="text/javascript" src="../js/vue-router.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <link type="text/css" rel="stylesheet" href="../css/bootstrap.min.css">
</head>

<body>
    <div class="container">
        <div id="app">
            <hk-btn></hk-btn>
            <hk-btn></hk-btn>
            <hk-btn></hk-btn>
            <hk-btn></hk-btn>
            <hk-btn></hk-btn>
        </div>

        <template id="temp1">
            <div style="height: 100px; background-color: gray;">
                该组件中的按钮被点击了{{count}}次
                <button class="btn btn-primary" @click="count += 1">全局组件hk-btn中的按钮</button>
            </div>
        </template>
    </div>
    <script>
        Vue.component('hk-btn', {
            template: '#temp1',
            data: function() {
                return {
                    count: 0
                }
            }
        });

        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {}
        });
    </script>
</body>

</html>